package com.ruoyi.datastatic.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.datastatic.domain.StDeptList;
import com.ruoyi.datastatic.service.IStDeptListService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 科室同步内容Controller
 * 
 * @author ruoyi
 * @date 2025-09-20
 */
@RestController
@RequestMapping("/stDeptList")
public class StDeptListController extends BaseController
{
    @Autowired
    private IStDeptListService stDeptListService;

    /**
     * 查询科室同步内容列表
     */
    @RequiresPermissions("stDeptList:list:list")
    @GetMapping("/list")
    public TableDataInfo list(StDeptList stDeptList)
    {
        startPage();
        List<StDeptList> list = stDeptListService.selectStDeptListList(stDeptList);
        return getDataTable(list);
    }

    /**
     * 导出科室同步内容列表
     */
    @RequiresPermissions("stDeptList:list:export")
    @Log(title = "科室同步内容", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, StDeptList stDeptList)
    {
        List<StDeptList> list = stDeptListService.selectStDeptListList(stDeptList);
        ExcelUtil<StDeptList> util = new ExcelUtil<StDeptList>(StDeptList.class);
        util.exportExcel(response, list, "科室同步内容数据");
    }

    /**
     * 获取科室同步内容详细信息
     */
    @RequiresPermissions("stDeptList:list:query")
    @GetMapping(value = "list/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(stDeptListService.selectStDeptListById(id));
    }

    /**
     * 新增科室同步内容
     */
    @RequiresPermissions("stDeptList:list:add")
    @Log(title = "科室同步内容", businessType = BusinessType.INSERT)
    @PostMapping("add")
    public AjaxResult add(@RequestBody StDeptList stDeptList)
    {
        return toAjax(stDeptListService.insertStDeptList(stDeptList));
    }

    /**
     * 修改科室同步内容
     */
    @RequiresPermissions("stDeptList:list:edit")
    @Log(title = "科室同步内容", businessType = BusinessType.UPDATE)
    @PutMapping("update")
    public AjaxResult edit(@RequestBody StDeptList stDeptList)
    {
        return toAjax(stDeptListService.updateStDeptList(stDeptList));
    }

    /**
     * 删除科室同步内容
     */
    @RequiresPermissions("stDeptList:list:remove")
    @Log(title = "科室同步内容", businessType = BusinessType.DELETE)
	@DeleteMapping("remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(stDeptListService.deleteStDeptListByIds(ids));
    }
}
